﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HCI.Questionaire.Exceptions;
using System.Collections.Generic;

namespace HCI.Questionaire.Entities
{
    public class RatingQuestionGroup : Question
    {
        public List<RatingQuestion> QuestionList {
            get
            {
                return this.questionList;
            }      
        }
        private List<RatingQuestion> questionList;

        public RatingQuestionGroup()
        {
            questionList = new List<RatingQuestion>();
        }

        public void Add(RatingQuestion q)
        {
            q.AnswerValueChange+=new Action<Answer>(q_AnswerValueChange);
            questionList.Add(q);
        }

        void q_AnswerValueChange(Answer ans)
        {
            this.OnAnswerValueChange(ans);
        }

        public List<RatingQuestion> GetQuestionList()
        {
            return questionList;
        }

        public override void ValidateAnswer()
        {
            foreach (var question in questionList)
                question.ValidateAnswer();
        }
  
    }
}
